#include<stdio.h>
#include<stdlib.h>
main()
{
      int i=1000,j,*sv,*orsv,t;
      int o=1;
      while(o==1){         
                 system("cls");           
      printf("How many students do you wanna compare mark?\nEnter the number of students: ");
      scanf("%d",&t);
      sv=(int*) calloc(t,sizeof(int));
      orsv=(int*) calloc(t,sizeof(int));
      for(i=1;i<=t;i++)
      {
                       printf(" Enter the mark of student[%d]:",i);
                       scanf("%d",&sv[i]);}
//gan xong cac gia tri
       for(j=1;j<=t;j++){
                         orsv[j]=sv[j]; }
                          //luu lai 1 mang nua de so sanh
for(i=1;i<t;i++){
                 for(j=i+1;j<=t;j++){
                 if(sv[i]<sv[j]){
                 int temp;
                 temp=sv[i];
                 sv[i]=sv[j];
                 sv[j]=temp;}
                                  }
                                  }//sap xep lai theo thu s
                                           for(i=t;i>=1;i--){
                                           printf("\nThe mark of student at %d position is: %d",i,sv[i]);
                                                       }            
                                           printf("the max mark is %d \n",sv[1]);
                                           printf("the min mark is %d",sv[t]);
                 free(sv);
                 free(orsv); 
                 printf("Do you wanna continue?\nPress 1 to continue or others to quit:");
                 scanf("%d",&o);}
                      printf("Goodbye!!!");
                      return;        
                       }
                       
